home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Visual Basic Source Code
/
Visual Basic Source Code.iso
/
vbsource
/
simple4a
/
brain.bas
next >
Wrap
BASIC Source File
|
1999-09-19
|
7KB
|
243 lines
Attribute VB_Name = "Brain"
Option Explicit
Global HTMLData As Boolean
Dim htmrows As Long
Dim htmcols As Long
Dim htmtitle As String
Sub main()
HTMLData = False
frmHTMLEditor.Show
End Sub
Function AddLinkTable(ColumnCount As Long, RowCount As Long, TitleLine As String) As String
'Add table with embedded HTML links
Dim temp$
Dim j As Long
Dim k As Long
Dim quote$
quote$ = Chr$(34)
temp$ = "<TABLE WIDTH=100% BORDER=4>" & vbCrLf
temp$ = temp$ & "<TR>" & vbCrLf
temp$ = temp$ & "<TH COLSPAN=" & ColumnCount
temp$ = temp$ & "><FONT SIZE=5>" & TitleLine & "<FONT SIZE=3></TH>" & vbCrLf
temp$ = temp$ & "</TR>" & vbCrLf
For j = 1 To RowCount
temp$ = temp$ & "<TR>" & vbCrLf & "<TD><A HREF=" & quote$ & "siteaddr" & quote$ & ">" & "sitelbl" & "</A><BR></TD>" & vbCrLf
If ColumnCount > 1 Then
For k = 2 To ColumnCount
temp$ = temp$ & "<TD><A HREF=" & quote$ & "siteaddr" & quote$ & " >" & "sitelbl" & " </A><BR></TD>" & vbCrLf
Next k
End If
temp$ = temp$ & "</TR>" & vbCrLf & vbCrLf
Next j
temp$ = temp$ & "</TABLE>" & vbCrLf & "<BR>" & vbCrLf
AddLinkTable = temp$
End Function
Function AddTable(ColumnCount As Long, RowCount As Long, TitleLine As String) As String
'Add table
Dim temp$
Dim j As Long
Dim k As Long
Dim quote$
quote$ = Chr$(34)
temp$ = "<TABLE WIDTH=100% BORDER=4>" & vbCrLf
temp$ = temp$ & "<TR>" & vbCrLf
temp$ = temp$ & "<TH COLSPAN=" & ColumnCount
temp$ = temp$ & "><FONT SIZE=5>" & TitleLine & "<FONT SIZE=3></TH>" & vbCrLf
temp$ = temp$ & "</TR>" & vbCrLf
For j = 1 To RowCount
temp$ = temp$ & "<TR>" & vbCrLf & "<TD>" & "data" & "<BR></TD>" & vbCrLf
If ColumnCount > 1 Then
For k = 2 To ColumnCount
temp$ = temp$ & "<TD>" & "data" & "<BR></TD>" & vbCrLf
Next k
End If
temp$ = temp$ & "</TR>" & vbCrLf & vbCrLf
Next j
temp$ = temp$ & "</TABLE>" & vbCrLf & "<BR>" & vbCrLf
AddTable = temp$
End Function
Function AddPicElement(PictureName As String, BorderValue As Integer) As String
AddPicElement = "<IMG SRC=" & PictureName & " BORDER=" & BorderValue & ">" & vbCrLf
End Function
Sub ColorsOn()
With frmHTMLEditor
.cmdBTApproved.Visible = True
.rtbHTML.Visible = False
.txtPicture.Visible = True
.cmdPicture.Visible = True
.Label1(4).Visible = True
.Combo1.Visible = True
.Combo2.Visible = True
.Combo3.Visible = True
.Combo4.Visible = True
.Label1(0).Visible = True
.Label1(1).Visible = True
.Label1(2).Visible = True
.Label1(3).Visible = True
.cmdColorDone.Visible = True
.cmdCancelColor.Visible = True
.Combo1.SetFocus
End With
End Sub
Sub ColorsOff()
With frmHTMLEditor
.cmdBTApproved.Visible = False
.rtbHTML.Visible = True
.txtPicture.Visible = False
.cmdPicture.Visible = False
.Label1(4).Visible = False
.Combo1.Visible = False
.Combo2.Visible = False
.Combo3.Visible = False
.Combo4.Visible = False
.Label1(0).Visible = False
.Label1(1).Visible = False
.Label1(2).Visible = False
.Label1(3).Visible = False
.cmdColorDone.Visible = False
.cmdCancelColor.Visible = False
End With
End Sub
Sub StuffColors(Trgt As ComboBox)
Trgt.Clear
Trgt.AddItem "Aqua"
Trgt.AddItem "Black"
Trgt.AddItem "Blue"
Trgt.AddItem "Fuchsia"
Trgt.AddItem "Gray"
Trgt.AddItem "Green"
Trgt.AddItem "Lime"
Trgt.AddItem "Maroon"
Trgt.AddItem "Navy"
Trgt.AddItem "Olive"
Trgt.AddItem "Purple"
Trgt.AddItem "Red"
Trgt.AddItem "Silver"
Trgt.AddItem "Teal"
Trgt.AddItem "White"
Trgt.AddItem "Yellow"
Trgt.Text = "White"
End Sub
Function BodyColorScheme() As String
Dim temp$
Dim quote$
quote$ = Chr$(34)
'<BODY BACKGROUND="e:\smachine\downloads\bondage\sh1016.jpg" BGCOLOR="Tan" TEXT="MAROON" LINK="AQUA" VLINK="BLUE" >
With frmHTMLEditor
'<BODY BGCOLOR="PURPLE"" TEXT="WHITE" LINK="AQUA" VLINK="RED" >
If Len(Trim(.txtPicture.Text)) < 1 Then
temp$ = "<BODY BGCOLOR=" & quote$ & .Combo1.Text & quote$ & " TEXT=" & quote$ & .Combo2.Text & quote$ & _
" LINK=" & quote$ & .Combo3.Text & quote$ & " VLINK=" & quote$ & .Combo4.Text & quote$ & " >"
Else
temp$ = "<BODY BACKGROUND=" & quote$ & .txtPicture.Text & quote$ & " BGCOLOR=" & quote$ & .Combo1.Text & quote$ & " TEXT=" & quote$ & .Combo2.Text & quote$ & _
" LINK=" & quote$ & .Combo3.Text & quote$ & " VLINK=" & quote$ & .Combo4.Text & quote$ & " >"
End If
End With
BodyColorScheme = temp$
End Function
Function PickAPicture() As String
With frmHTMLEditor
.CommonDialog1.DialogTitle = "Select a picture file."
.CommonDialog1.Flags = &H4& Or &H2&
.CommonDialog1.DefaultExt = "JPG"
.CommonDialog1.Filter = "JPeg (*.jpg)|*.jpg|GIF (*.gif)|*.gif|BMP (*.BMP)|*.bmp"
.CommonDialog1.ShowOpen
PickAPicture = .CommonDialog1.FileName
End With
End Function
Sub SaveAPage()
With frmHTMLEditor
.CommonDialog1.DialogTitle = "SAVE HTML FILE"
.CommonDialog1.Filter = "HTML Files (*.html)|*.html|HTM Files (*.htm)|*.htm)"
.CommonDialog1.DefaultExt = "HTML"
.CommonDialog1.Flags = &H4& Or &H2&
.CommonDialog1.ShowSave
Dim fileNum As Integer
fileNum = FreeFile
If .CommonDialog1.FileName <> "" Then
Open .CommonDialog1.FileName For Output As #fileNum
Print #fileNum, .rtbHTML.Text
Close #fileNum
End If
End With
End Sub
Sub LoadAPage(mode As Boolean)
'if mode is false, replace selected text (insert)
'if mode if true, replace all text (load)
Dim temp$
Dim Big$
Dim fileNum As Integer
fileNum = FreeFile
With frmHTMLEditor
.CommonDialog1.DialogTitle = "LOAD HTML FILE"
.CommonDialog1.Filter = "HTML Files (*.html)|*.html|HTM Files (*.htm)|*.htm)"
.CommonDialog1.DefaultExt = "HTML"
.CommonDialog1.Flags = &H4& Or &H2&
.CommonDialog1.ShowOpen
If .CommonDialog1.FileName <> "" Then
frmHTMLEditor.rtbHTML.LoadFile .CommonDialog1.FileName
' Open .CommonDialog1.FileName For Input As #fileNum
' Do While Not EOF(fileNum)
' Line Input #fileNum, temp$
' Debug.Print temp$
' Big$ = Big$ & temp$
' Loop
' Close #fileNum
End If
If mode = True Then
'Overwrite mode
' .rtbHTML.SelStart = 0
' .rtbHTML.SelLength = Len(.rtbHTML.Text)
' .rtbHTML.SelRTF = Big$
Else
'Insert mode
.rtbHTML.SelLength = 0
.rtbHTML.SelRTF = Big$
End If
End With
End Sub